{% extends 'admin/base.html' %}

{% block title %}编辑公告{% endblock %}

{% block extra_css %}
<style>
    .dashboard-link {
        display: inline-block;
        cursor: pointer;
        position: relative;
        z-index: 25;
        pointer-events: auto !important;
    }
    .dashboard-link .td_btn_in {
        pointer-events: auto !important;
    }
</style>
{% endblock %}

{% block content %}
<!-- 额外添加顶部间距，避免base.html中的元素遮挡 -->
<div style="height: 35px;"></div>
<div class="row">
    <div class="col-12">
        <div class="d-flex justify-content-between align-items-center mb-4">
            <h2 class="td_fs_36 td_medium">编辑公告</h2>
            <a href="{% url 'admin_announcements' %}" class="td_btn td_style_1 td_type_3 td_radius_10 td_medium dashboard-link">
                <span class="td_btn_in td_accent_color">
                    <i class="fas fa-arrow-left me-2"></i><span>返回公告列表</span>
                </span>
            </a>
        </div>

        <div class="card td_radius_10 td_gray_bg_5">
            <div class="card-header">
                <h4 class="mb-0 td_fs_24 td_medium">公告信息</h4>
            </div>
            <div class="card-body">
                <form method="POST">
                    {% csrf_token %}
                    <div class="mb-3">
                        <label for="title" class="form-label td_medium">标题</label>
                        <input type="text" class="td_form_field td_medium td_white_bg" id="title" name="title" 
                               value="{{ announcement.title }}" required>
                    </div>
                    <div class="mb-3">
                        <label for="content" class="form-label td_medium">内容</label>
                        <textarea class="td_form_field td_medium td_white_bg" id="content" name="content" 
                                  rows="5" required>{{ announcement.content }}</textarea>
                    </div>
                    <button type="submit" class="td_btn td_style_1 td_radius_10 td_medium">
                        <span class="td_btn_in td_white_color td_accent_bg">
                            <i class="fas fa-save me-2"></i><span>更新公告</span>
                        </span>
                    </button>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %} 